package com.process.Imp.servUtil;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.process.dao.pojoDao.StudentDao;
import com.process.domain.publi.Student;
import com.process.service.ExcelServ.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> implements StudentService {
    @Autowired
    private StudentDao studentDao;


    @Override
    public List<Student> selectClassStudent(String studentPhone) {

        LambdaQueryWrapper<Student> stuIdEq = new LambdaQueryWrapper<Student>()
                .eq(Student::getStuPhone, studentPhone);
        Student student = studentDao.selectOne(stuIdEq);


        long classId = student.getClassId();


        LambdaQueryWrapper<Student> classEq = new LambdaQueryWrapper<Student>()
                .select(Student::getStuId,
                        Student::getStuName,
                        Student::getStuSex,
                        Student::getClassId,
                        Student::getStuIdentity,
                        Student::getStuCollege,
                        Student::getStuPhone,
                        Student::getAttendedDate
                )
                .eq(Student::getClassId, classId);
        List<Student> students = studentDao.selectList(classEq);

        return students;
    }
}
